﻿using System;

using System.Collections.Generic;

using System.Text;

namespace MountainORocks
{
    [Serializable]
    public class LevelData
    {
        public List<ShapeData> level;
        public List<ShapeDataDroper> droper;
        public int numOfLevel = 0;
        public float playerX;
        public float playerY;
        public bool isBonus = false;
        public LevelData()
        {
            droper = new List<ShapeDataDroper>();
            level = new List<ShapeData>();
        }

        public void getCount(int count)
        {
            numOfLevel = count + 1;
        }

        public void getPlayerLoc(float x, float y)
        {
            playerX = x;
            playerY = y;
        }

        public void getDate(List<GameShape> Nlevel, List<dropStuff> Ndrop, List<GameShape> Nloded)
        {

            foreach (GameShape myShape in Nlevel)
            {
                ShapeData tmp = new ShapeData();
                tmp.getDate(myShape);
                level.Add(tmp);

            }
            foreach (GameShape myShape in Nloded)
            {
                ShapeData tmp = new ShapeData();
                tmp.getDate(myShape);
                level.Add(tmp);

            }

            foreach (dropStuff mydrop in Ndrop)
            {
                ShapeDataDroper tmp = new ShapeDataDroper();
                tmp.getDate(mydrop);
                droper.Add(tmp);

            }
            
        }


    }


    [Serializable]
    public class ShapeData
    {
        public int positionX;
        public int positionY;
        public int width;
        public int hight;
        public string type;
        public string material;
        public int colorR;
        public int colorG;
        public int colorB;
        public int colorA;

        public double rotation;
        public float mass;
        public double friction;
        public bool isStatic;



        public ShapeData()
        {
        }

        public void getDate(GameShape shape)
        {
            positionX = (int)shape.body.Position.X;
            positionY = (int)shape.body.Position.Y;
            width = shape.position.Width;
            hight = shape.position.Height;
            colorA = shape.Color.A;
            colorR = shape.Color.R;
            colorG = shape.Color.G;
            colorB = shape.Color.B;

            type = shape.shapeType.ToString();
            material = shape.shapMat.ToString();
            rotation = shape.body.Rotation;
            mass = shape.body.Mass;
            friction = shape.body.Friction;
            isStatic = shape.body.IsStatic;
            

           
        }


    }


    [Serializable]
    public class ShapeDataDroper
    {
       public float tmpSizeX;
        public float tmpSizeY;
       public bool tmpStatic; 
       public double tmpTime; 
       public int tmpCoun;
       public int xPlace;
       public int yPlace;
       public bool rand;




       public ShapeDataDroper()
        {
        }

       public void getDate(dropStuff droper)
       {
           tmpSizeX = droper.getSizeX();
           tmpSizeY = droper.getSizeY();
           tmpStatic = droper.getStatic();
           tmpTime = droper.getTmpTime();
           tmpCoun = droper.getCount();
           xPlace = droper.getXplace();
           yPlace = droper.getYplace();
           rand = droper.getrand();

       }


    }


}
